<template>
  <up-overlay :show="show">
    <view class="ip-box">
      <image class="box-ip" src="https://cbandu.oss-cn-qingdao.aliyuncs.com/yusj/20250516/model_ip.png" />
      <view class="confirm-box">
        <view class="box-title">
          <image class="title-img" src="https://cbandu.oss-cn-qingdao.aliyuncs.com/yusj/20250516/model_icon.png" />
          <text class="title-text">
            {{ title }}
          </text>
          <image class="title-img" src="https://cbandu.oss-cn-qingdao.aliyuncs.com/yusj/20250516/model_icon.png" />
        </view>

        <view class="box-content">
          <image class="content-icon" src="https://cbandu.oss-cn-qingdao.aliyuncs.com/yusj/20250516/model_yes.png" />
          <text class="content-text">
            恭喜你获得
            <text class="content-text-num">
              {{ number }}
            </text>
            枚星币
          </text>
        </view>

        <view v-if="info" class="box-info">
          {{ info }}
        </view>

        <view class="box-btn">
          <view class="btn-item" @click="handleEnd">
            我知道了
          </view>
        </view>
      </view>
    </view>
  </up-overlay>
</template>

<script lang="ts" setup>
defineOptions({
  options: {
    styleIsolation: 'shared',
  },
});

defineProps({
  show: {
    type: Boolean,
    default: false,
  },
  title: {
    type: String,
    default: '签到成功',
  },
  number: {
    type: [String, Number],
    default: '10+5',
  },
  info: {
    type: String,
    default: '已连续签到2天，明天签到可额外获得5星币',
  },
});

const emit = defineEmits(['update:show', 'close']);

const handleEnd = () => {
  emit('update:show', false);
  emit('close');
};
</script>

<style lang="scss" scoped>
.ip-box {
  position: relative;
  width: 630rpx;
  padding-top: 169rpx;

  .box-ip {
    position: absolute;
    left: 133rpx;
    top: 0;
    width: 336rpx;
    height: 228rpx;
  }
}

.confirm-box {
  position: relative;
  width: 630rpx;
  padding: 40rpx;
  border-radius: 32rpx;
  overflow: hidden;
  background: #fff;

  .box-title {
    display: flex;
    align-items: center;
    justify-content: center;

    .title-img {
      width: 22rpx;
      height: 22rpx;
    }

    .title-text {
      padding: 0 16rpx;
      font-size: 44rpx;
      color: #0F194D;
      line-height: 66rpx;
    }
  }

  .box-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50rpx 0;

    .content-icon {
      width: 64rpx;
      height: 64rpx;
      margin-right: 24rpx;
    }

    .content-text {
      font-size: 32rpx;
      color: #0F194D;
      line-height: 48rpx;
      text-align: center;
    }

    .content-text-num {
      display: inline-block;
      padding: 0 8rpx;
      font-size: 56rpx;
      color: #0F194D;
      line-height: 64rpx;
      font-weight: bold;
    }
  }

  .box-info {
    padding-top: -26rpx;
    padding-bottom: 40rpx;
    font-size: 28rpx;
    color: #87837B;
    line-height: 42rpx;
    text-align: center;
  }

  .box-btn {
    display: flex;

    .btn-item {
      flex: 1;
      background: linear-gradient( 90deg, #FFA029 0%, #FFCD29 100%);
      color: #FFFFFF;
      text-align: center;
      font-weight: bold;
      font-size: 32rpx;
      line-height: 92rpx;
      border-radius: 46rpx;
    }
  }
}
</style>

<style lang="css">
.u-transition {
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
